
import Person from "./person.js";
import Class from "./class.js";
import Student from "./student.js";

module.exports = class Teacher extends Person{
    constructor(id,name ,age ,klasses){
        super(id ,name ,age);
        this.klasses = klasses;
    }
    introduce(){
        if(this.klasses == null){
            return `${super.introduce()} I am a Teacher. I teach No Class.`;            
        }
        else{
            return `${super.introduce()} I am a Teacher. I teach Class ${this.klasses[0].number}, ${this.klasses[1].number}.`;                    
        }
    }
    isTeaching(student){
        for(let itemclass of this.klasses){
            if(student.klass == itemclass){
                return true;
            }
            return false;
        }
    }

}

